<template>
  <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'" :close-on-click-modal="false" :visible.sync="visible" class="cu-dialog cu-dialog_center" lock-scroll width="800px">
    <el-row :gutter="15" class="">
      <el-form ref="elForm" :model="dataForm" size="mini" label-width="100px" label-position="right" :rules="rules">
        <el-col :span="12">
          <el-form-item label="校区名称" prop="campusId">
            <el-select v-model="dataForm.campusId" placeholder="请选择" disabled filterable clearable required :style="{ width: '100%' }">
              <el-option v-for="(item, index) in campusOptions" :key="index" :label="item.fullName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="保证金" prop="expectedRefundAmount">
            <el-input v-model="dataForm.expectedRefundAmount" disabled placeholder="请输入" clearable required :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="闭校类别" prop="type">
            <el-select v-model="dataForm.type" placeholder="请选择" :disabled="!!isDetail" clearable required :style="{ width: '100%' }">
              <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.fullName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="保证金审核" prop="refundDeposit">
            <el-select v-model="dataForm.refundDeposit" placeholder="请选择" :disabled="!!isDetail" clearable required :style="{ width: '100%' }">
              <el-option v-for="(item, index) in refundDepositOptions" :key="index" :label="item.fullName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="闭校时间" prop="closureDate">
            <el-date-picker v-model="dataForm.closureDate" :disabled="!!isDetail" placeholder="请选择" clearable required :style="{ width: '100%' }" type="date" format="yyyy-MM-dd" value-format="timestamp"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="闭校说明" prop="closureNotes">
            <el-input v-model="dataForm.closureNotes" :disabled="!!isDetail" placeholder="请输入" required show-word-limit :style="{ width: '100%' }" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="退款状态" prop="refundStatus">
            <el-select v-model="dataForm.refundStatus" placeholder="请选择" clearable required :style="{ width: '100%' }" @change="hanlderChangStatus">
              <el-option v-for="(item, index) in refundStatusOptions" :key="index" :label="item.fullName" :value="item.enCode"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="status">
          <el-form-item label="退还金额" prop="refundAmount">
            <el-input v-model="dataForm.refundAmount" placeholder="请输入" clearable required :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="status">
          <el-form-item label="退款时间" prop="refundDate">
            <el-date-picker v-model="dataForm.refundDate" placeholder="请选择" clearable required :style="{ width: '100%' }" type="date" format="yyyy-MM-dd" value-format="timestamp"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="24" v-if="status">
          <el-form-item label="退款说明" prop="refundNotes">
            <el-input v-model="dataForm.refundNotes" placeholder="请输入" required show-word-limit :style="{ width: '100%' }" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="附件" prop="attachments">
            <custom-upload-fz v-model="dataForm.attachments" required :fileSize="5" sizeUnit="MB" :limit="9" buttonText="点击上传"></custom-upload-fz>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="是否发送邮件" prop="isEmail">
            <el-checkbox v-model="dataForm.isEmail"></el-checkbox>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="收件人" prop="emailTo">
            <org-select ref="user-org" buttonType="button" v-model="dataForm.emailTo" title="添加用户" class="mb-10" @change="onOrgChange" />
          </el-form-item>
        </el-col>
        <!-- <el-col :span="24">
          <el-form-item label="抄送人" prop="emailCC">
            <email-input v-model="dataForm.emailCC"></email-input>
          </el-form-item>
        </el-col> -->
      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取 消</el-button>
      <el-button type="primary" @click="dataFormSubmit()" :loading="btnloading">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { status } from 'nprogress'

export { default } from './index.js'
</script>
